package com.edu.chat.web.config;

import com.edu.chat.web.config.Interceptor.PublicTenantInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器配置
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

	private final PublicTenantInterceptor publicTenantInterceptor;

	public WebConfig(PublicTenantInterceptor publicTenantInterceptor) {
		this.publicTenantInterceptor = publicTenantInterceptor;
	}

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(publicTenantInterceptor)
				.addPathPatterns("/chat/category/**", "/chat/library/**","/chat/article/**"); // 排除公共接口
	}
}